using System.ComponentModel.DataAnnotations;

namespace RAG.Application.Dtos;

/// <summary>
/// 问答列表查询DTO
/// </summary>
public class QAListQueryDto
{
    public int Page { get; set; } = 1;
    public int PageSize { get; set; } = 10;
    public string? Keyword { get; set; }
    public string? Model { get; set; }
    public DateTime? StartDate { get; set; }
    public DateTime? EndDate { get; set; }
    public Guid? SessionId { get; set; }
}

/// <summary>
/// 问答详情DTO
/// </summary>
public class QADetailDto
{
    public Guid Id { get; set; }
    public Guid? SessionId { get; set; }
    public string SessionTitle { get; set; } = string.Empty;
    public string Question { get; set; } = string.Empty;
    public string Answer { get; set; } = string.Empty;
    public string? SourceChunks { get; set; }
    public string Model { get; set; } = string.Empty;
    public int PromptTokens { get; set; }
    public int CompletionTokens { get; set; }
    public int LatencyMs { get; set; }
    public DateTime CreatedAt { get; set; }
    public Guid UserId { get; set; }
    public string UserName { get; set; } = string.Empty;
    public bool IsOwner { get; set; }
}

/// <summary>
/// 问答统计DTO
/// </summary>
public class QAStatisticsDto
{
    public int TotalConversations { get; set; }
    public int TodayConversations { get; set; }
    public int TotalTokens { get; set; }
    public double AverageLatency { get; set; }
    public Dictionary<string, int> ModelUsage { get; set; } = new();
    public Dictionary<string, int> DailyUsage { get; set; } = new();
}

/// <summary>
/// 批量删除问答DTO
/// </summary>
public class BatchDeleteQADto
{
    [Required(ErrorMessage = "问答ID列表不能为空")]
    public List<Guid> Ids { get; set; } = new();
}

/// <summary>
/// 导出问答DTO
/// </summary>
public class ExportQADto
{
    public string Format { get; set; } = "json"; // json, csv, excel
    public DateTime? StartDate { get; set; }
    public DateTime? EndDate { get; set; }
    public string? Keyword { get; set; }
    public string? Model { get; set; }
    public Guid? SessionId { get; set; }
}
